package com.home.rhclient;

import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.TimeZone;

import com.home.communication.RestfulConnector;

import android.app.Activity;
import android.content.Context;

public class MainController {
	
	private static MainController instance;
	public Activity currentActivity;
	
	private HashMap<String, Integer> categoriesMap;
	
	
	
	public Encryptor encryptor;
	public RestfulConnector restConnector;
	
	public static MainController GetInstance()
	{
		return instance;
	}
	
	public static void Initialize(Context context)
	{
		if (instance==null)
		{
			instance=new MainController(context);
		}
	}
	
	
	public MainController(Context context) {
		try {
			encryptor=new Encryptor(context);
			restConnector=new RestfulConnector(encryptor);
			categoriesMap=new HashMap<String, Integer>();
			
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public void onActivityPaused()
	{
		
	}
	
	public Date GetCurrentDate()
	{
		Calendar cal=Calendar.getInstance();
		//Add time of request
		cal.setTimeZone(TimeZone.getTimeZone("GMT"));
		return cal.getTime();
	}

}
